package com.aids_malaria.adapter;


import android.content.Context;

import com.aids_malaria.R;
import com.aids_malaria.base.BaseQuickAdapter;
import com.aids_malaria.base.BaseViewHolder;
import com.aids_malaria.http.response.MosquitoInvest;

import java.util.List;

public class MosquitoBorneDataAdapter extends BaseQuickAdapter<MosquitoInvest> {

    public MosquitoBorneDataAdapter(Context context, int layoutResID, List<MosquitoInvest> data) {
        super(context, layoutResID, data);
    }

    @Override
    public void convert(BaseViewHolder holder, MosquitoInvest item) {
        if (holder.getAdapterPosition() % 2 > 0){
            holder.getView(R.id.item).setBackgroundColor(mContext.getResources().getColor(R.color.c_item2));
        }else {
            holder.getView(R.id.item).setBackgroundColor(mContext.getResources().getColor(R.color.c_item1));
        }
        holder.setText(R.id.tv_sort,item.getSortTypeName());
        if(item.getSortType() == MosquitoInvest.SORT_TYPE_AEDES){
            holder.setText(R.id.tv_density,"" + item.getAedes_density());
            holder.setText(R.id.tv_bit_rate,"" + item.getAedes_bit_rate());
            holder.setText(R.id.tv_infect_rate,"" + item.getAedes_infect_rate());
        }else if(item.getSortType() == MosquitoInvest.SORT_TYPE_ANOPHELES){
            holder.setText(R.id.tv_density,"" + item.getAnopheles_density());
            holder.setText(R.id.tv_bit_rate,"" + item.getAnopheles_bit_rate());
            holder.setText(R.id.tv_infect_rate,"" + item.getAnopheles_infect_rate());
        }else if(item.getSortType() == MosquitoInvest.SORT_TYPE_CULEX){
            holder.setText(R.id.tv_density,"" + item.getCulex_density());
            holder.setText(R.id.tv_bit_rate,"" + item.getCulex_bit_rate());
            holder.setText(R.id.tv_infect_rate,"" + item.getCulex_infect_rate());
        }else{
            holder.setText(R.id.tv_density,"" + item.getOther_density());
            holder.setText(R.id.tv_bit_rate,"" + item.getOther_bit_rate());
            holder.setText(R.id.tv_infect_rate,"" + item.getOther_infect_rate());
        }

    }

}
